package org.libl.web.servlet.car;

import org.libl.dao.car.CarDao;
import org.libl.dao.car.impl.CarDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/car/addcar")
public class addCarController extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{

        String car_sn = request.getParameter("car_sn");
        String car_name = request.getParameter("car_name");
        String car_stutus = request.getParameter("car_stutus");
        String car_jiage = request.getParameter("car_jiage");

        CarDao dao = new CarDaoImpl();
        int b = dao.addCar(car_sn,car_name,car_stutus,car_jiage);
        System.out.println(b);
        response.setCharacterEncoding("utf-8");
        response.getWriter().write("成功");

//        request.setAttribute("pageBean",pageBean);
//        request.getRequestDispatcher("/student/page.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
        doPost(request, response);
    }
}
